package user

import (
	"context"
	"git.mycaigou.com/gfyx/micro-gfyx-oppty-service/infrastructure/common/utils"
	"git.mycaigou.com/gfyx/micro-gfyx-oppty-service/infrastructure/dto/base"
	"git.mycaigou.com/gfyx/micro-gfyx-oppty-service/infrastructure/repository/base/org"
	"git.mycaigou.com/gfyx/micro-gfyx-oppty-service/infrastructure/repository/base/role"
	"git.mycaigou.com/gfyx/micro-gfyx-oppty-service/infrastructure/repository/base/user"
	basePb "git.mycaigou.com/gfyx/micro-gfyx-oppty-service/proto/micro_gfyx_oppty_service_proto/micro-gfyx-oppty-service/base"
)

type UserServiceIface interface {
	// UserList 账号列表
	UserList(ctx context.Context, orgId int64, status int32, keyword string, page *utils.PageInfo) ([]*user.GfyxUserPo, *utils.PageInfo, error)
	// UserSave 新增/修改账号信息
	UserSave(ctx context.Context, userObj *user.GfyxUserPo, orgIds []int64, roleIds []int64) (int64, error)
	// UserDelete 删除账号
	UserDelete(ctx context.Context, userId int64) (int64, error)
	// UserForbid 禁用用户
	UserForbid(ctx context.Context, userId int64, status int32) (int64, error)
	// UserAuthRoles 账号授权
	UserAuthRoles(ctx context.Context, userId int64, roleIds []int64) error
	// ListByUserIds 获取组织列表
	ListByUserIds(ctx context.Context, userIds []int64) (map[int64][]*org.GfyOrganizationPo, map[int64][]*user.GfyxUserOrganizationRelationPo, map[int64][]*role.GfyRolePo, error)
	// UserDetail 用户详情
	UserDetail(ctx context.Context, userId int64) (*user.GfyxUserPo, []*org.GfyOrganizationPo, []*role.GfyRolePo, error)
	// UserInfo 获取用户信息
	UserInfo(ctx context.Context, request basePb.UserInfoRequest) (*basePb.UserInfoResponse, error)
	// SetPassword 设置密码
	SetPassword(ctx context.Context, request basePb.ResetPasswordRequest) (*basePb.ResetPasswordResponse, error)
	// UpdateAdminPassword 修改admin密码
	UpdateAdminPassword(ctx context.Context, request basePb.UpdateAdminPasswordRequest) (*basePb.UpdateAdminPasswordResponse, error)
	// SetDepartmentHeader 设置/取消负责人
	SetDepartmentHeader(ctx context.Context, userId []int64, orgId int64) error
	// ChangeUserStatusByProfitAccountNum 冻结或解冻用户，根据可用权益可用账号数量来调整
	// 当用户数超过可用账号数时，冻结一部分用户账号，冻结场景为权益到期冻结
	// 当用户数小于可用账号数时，解冻一部分因权益到期禁用的账号
	ChangeUserStatusByProfitAccountNum(ctx context.Context, accountNum int32) error
	// SyncUserForJM 同步建模用户到用户表
	SyncUserForJM(ctx context.Context, request basePb.BaseOldUserSyncRequest) (*basePb.BaseOldUserSyncResponse, error)
	// GetAllUser 获取全量用户
	GetAllUser(ctx context.Context) (int32, []*user.GfyxUserPo, error)
	// GetAllUserWithOrganization 获取全量用户，带组织架构
	GetAllUserWithOrganization(ctx context.Context) (*basePb.GetAllUserWithOrganizationResponse, error)
	// ImportUsers 导入用户
	ImportUsers(ctx context.Context, userList []*base.ImportUserDto) (*basePb.UserImportUsersResponse, error)
	// GetRemainingUserCount 获取剩余可以添加的用户数
	GetRemainingUserCount(ctx context.Context) (int64, int64, error)
	GetUserInfoByUserGuid(ctx context.Context, userGuid string) (*user.GfyxUserPo, error)
	GetMyResponsibleAreaUserList(ctx context.Context, request *basePb.GetMyResponsibleAreaUserListRequest) (*basePb.GetMyResponsibleAreaUserListResponse, error)
}
